home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '93 / Papers '93 / Macintosh as Internet Server ƒ / inetd / Libraries / DaemonApp / PascalString.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-19  |  18.5 KB  |  761 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Friday, December 12, 1990 at 5:44 PM
  4.     PascalString.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1992
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PASCALSTRING__
  15. #define __PASCALSTRING__
  16.  
  17. #ifndef __STRING__
  18. #include <String.h>
  19. #endif
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. // Forward declaration for all the CString classes.
  26. struct CString;
  27. struct CStr255;
  28. struct CStr63;
  29. struct CStr32;
  30. struct CStr31;
  31.  
  32. typedef const unsigned char *ConstStr255Param;
  33. typedef ConstStr255Param ConstStr63Param, ConstStr32Param, ConstStr31Param,
  34.                          ConstStr27Param,ConstStr15Param;
  35.  
  36. typedef const CStr255& ConstCStr255Param;
  37. typedef const CStr63& ConstCStr63Param;
  38. typedef const CStr32& ConstCStr32Param;
  39. typedef const CStr31& ConstCStr31Param;
  40.  
  41. #ifndef __OSUTILS__
  42. #include <OSUtils.h>
  43. #endif
  44.  
  45. #ifdef NEVER
  46. typedef unsigned char Str255[256], Str63[64], Str32[33], 
  47.                         Str31[32], Str27[28], Str15[16], *StringPtr, **StringHandle;
  48. #endif
  49.  
  50. // Some constants defining the length of each of the CString types.
  51.  
  52. const short kLengthByte = 1;
  53. const short kBaseLen = 2;
  54. const short kStr255Len = 255;
  55. const short kStr63Len = 63;
  56. const short kStr32Len = 32;
  57. const short kStr31Len = 31;
  58.  
  59. // Some external function declarations so that we don't have to include more than
  60. // the minimal set of header files.
  61.  
  62. pascal char* PLSTRSTR(const CString& str1,
  63.                       const CString& str2);        // From PaslibIntf.p
  64.  
  65.  
  66. //----------------------------------------------------------------------------------------
  67. // CString: Superclass of all Pascal string compatible string classes.
  68. //----------------------------------------------------------------------------------------
  69.  
  70. typedef struct CString *CStringPtr, **CStringHandle;
  71.  
  72. struct CString
  73. {
  74. public:
  75.     unsigned char fStr[kBaseLen];
  76.  
  77. protected:
  78.     void InsertHelper(const CString& insStr,
  79.                       short pos,
  80.                       short maxLength);
  81.     void InsertHelper(const char* insStr,
  82.                       short pos,
  83.                       short maxLength);
  84.  
  85. public:
  86.  
  87.     // Basic length method, inherited by all derived classes. Define one that returns a
  88.     // reference. Can be used as an lvalue and only can be applied to non-const Strings.
  89.  
  90.     inline unsigned char& Length()
  91.     {
  92.         return fStr[0];
  93.     }                                            // for non-const CString
  94.  
  95.  
  96.     inline unsigned char Length() const
  97.     {
  98.         return fStr[0];
  99.     }                                            // for const CString
  100.  
  101.  
  102.     inline Boolean IsEmpty()
  103.     {
  104.         return fStr[0] <= 0;
  105.     }
  106.  
  107.     inline Boolean IsEmpty() const
  108.     {
  109.         return fStr[0] <= 0;
  110.     }
  111.  
  112.     // Character selector operator.
  113.  
  114.     unsigned char& operator[](short pos);            // for non-const CString
  115.                                                     // !!! try to inline later
  116.  
  117.     inline unsigned char operator[](short pos) const
  118.     {
  119.         return fStr[pos];
  120.     }                                            // for const CString
  121.     
  122.     //------------------------------------------------------------------------------------
  123.     // CAUTION: There is a subtle difference between the (char*) and (unsigned char*)
  124.     // converstion operators. The first converts a pascal-style string to a c-style
  125.     // string. The second simply converts between two types (CString and Str55) both of
  126.     // which are pascal-style strings.
  127.     
  128.     // Create a NULL terminated c-style string from a pascal-style CString. Used in
  129.     // debugging to fprintf a CString.
  130.     
  131.     operator char*() const;
  132.     
  133.     // Used to create a toolbox type Str255 from our CString. This is simply a type
  134.     // coersion! Both CString and Str255 are expected to be pascal-style strings.
  135.     
  136.     operator unsigned char*();
  137.     
  138.     operator const unsigned char*() const;
  139.  
  140.     //------------------------------------------------------------------------------------
  141.     
  142.     // Return an ID represented as a CString to the actual ID (a long).
  143.     
  144.     operator long() const;
  145.  
  146.     // Relational operators that are inherited by all the derived CString types. Three of
  147.     // each so that literal C Strings can be conveniently used for one of the operators as
  148.     // well as two of the derive classes as operators. These are declared here but defined
  149.     // below all the CString classes because they use constructors for CStr255 and its class
  150.     // definition has not been encountered yet.
  151.  
  152.     friend Boolean operator==(const CString& s1,
  153.                                      const char* s2);
  154.     friend Boolean operator==(const char* s1,
  155.                                      const CString& s2);
  156.     friend Boolean operator==(const CString& s1,
  157.                                      const CString& s2);
  158.  
  159.     friend Boolean operator!=(const CString& s1,
  160.                                      const char* s2);
  161.     friend Boolean operator!=(const char* s1,
  162.                                      const CString& s2);
  163.     friend Boolean operator!=(const CString& s1,
  164.                                      const CString& s2);
  165.  
  166.     friend Boolean operator>(const CString& s1,
  167.                                     const char* s2);
  168.     friend Boolean operator>(const char* s1,
  169.                                     const CString& s2);
  170.     friend Boolean operator>(const CString& s1,
  171.                                     const CString& s2);
  172.  
  173.     friend Boolean operator<(const CString& s1,
  174.                                     const char* s2);
  175.     friend Boolean operator<(const char* s1,
  176.                                     const CString& s2);
  177.     friend Boolean operator<(const CString& s1,
  178.                                     const CString& s2);
  179.  
  180.     friend Boolean operator>=(const CString& s1,
  181.                                      const char* s2);
  182.     friend Boolean operator>=(const char* s1,
  183.                                      const CString& s2);
  184.     friend Boolean operator>=(const CString& s1,
  185.                                      const CString& s2);
  186.  
  187.     friend Boolean operator<=(const CString& s1,
  188.                                      const char* s2);
  189.     friend Boolean operator<=(const char* s1,
  190.                                      const CString& s2);
  191.     friend Boolean operator<=(const CString& s1,
  192.                                      const CString& s2);
  193.  
  194.     // Concatenation operator that are inherited by all the derived CString types. Three
  195.     // of each so that literal C Strings can be conveniently used for one of the operators
  196.     // as well as using any two classes derived from CString.
  197.  
  198.     friend CStr255 operator+(const CString& s1,
  199.                             const char* s2);
  200.     friend CStr255 operator+(const char* s1,
  201.                             const CString& s2);
  202.     friend CStr255 operator+(const CString& s1,
  203.                             const CString& s2);
  204.  
  205.     // Methods that mimic the Pascal builtin CString functions for Pos, Insert and Delete.
  206.     // Note that insert and copy is implemented in the derived classes.
  207.  
  208.     unsigned char Pos(const char* subStr, unsigned char startPos = 1);
  209.     unsigned char Pos(const CString& subStr, unsigned char startPos = 1);
  210.     inline void Delete(short pos, short length);
  211. };
  212.  
  213.  
  214. //----------------------------------------------------------------------------------------
  215. // CStr255:
  216. //----------------------------------------------------------------------------------------
  217.  
  218. struct CStr255 : CString
  219. {
  220.  
  221.     friend struct CStr63;
  222.     friend struct CStr31;
  223.  
  224. private:
  225.     unsigned char fData[kStr255Len - 1];
  226.  
  227. public:
  228.     CStr255();
  229.     CStr255(const CStr255& str);
  230.     CStr255(const CStr63& str);
  231.     CStr255(const CStr32& str);
  232.     CStr255(const CStr31& str);
  233.     CStr255(const unsigned char* str);
  234.     CStr255(const char* str);
  235.     CStr255(const long id);
  236.  
  237.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  238.     
  239.     void Insert(const CString& str, short pos);
  240.     void Insert(const char* str, short pos);
  241.     CStr255 Copy(short pos, short length);
  242.                        
  243.     // Concatenation operator
  244.     
  245.     CStr255& operator +=(const CString& str);
  246.     CStr255& operator +=(const char* str);
  247.     CStr255& operator +=(const char ch);
  248.  
  249.     // Assignment operator
  250.  
  251.     CStr255& operator =(const CStr255& str);
  252.     CStr255& operator =(const CStr63& str);
  253.     CStr255& operator =(const CStr32& str);
  254.     CStr255& operator =(const CStr31& str);
  255.     CStr255& operator =(const unsigned char* str);
  256.     CStr255& operator =(const char aChar);
  257.     CStr255& operator =(const char* str);
  258.     
  259. };
  260.  
  261.  
  262. //----------------------------------------------------------------------------------------
  263. // CStr63:
  264. //----------------------------------------------------------------------------------------
  265.  
  266. struct CStr63 : CString
  267. {
  268.  
  269.     friend struct CStr255;
  270.     friend struct CStr31;
  271.  
  272. private:
  273.     unsigned char fData[kStr63Len - 1];
  274.  
  275. public:
  276.     CStr63();
  277.     CStr63(const CStr255& str);
  278.     CStr63(const CStr63& str);
  279.     CStr63(const CStr32& str);
  280.     CStr63(const CStr31& str);
  281.     CStr63(const unsigned char* str);
  282.     CStr63(const char* str);
  283.     CStr63(const long id);
  284.  
  285.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  286.     
  287.     void Insert(const CString& str,
  288.                        short pos);
  289.     void Insert(const char* str,
  290.                        short pos);
  291.     CStr63 Copy(short pos, short length);
  292.  
  293.     // Concatenation operator
  294.     
  295.     CStr63& operator +=(const CString& str);
  296.     CStr63& operator +=(const char* str);
  297.     CStr63& operator +=(const char ch);
  298. };
  299.  
  300.  
  301. //----------------------------------------------------------------------------------------
  302. // CStr32:
  303. //----------------------------------------------------------------------------------------
  304.  
  305. struct CStr32 : CString
  306. {
  307.  
  308.     friend struct CStr255;
  309.     friend struct CStr63;
  310.  
  311. private:
  312.     unsigned char fData[kStr32Len - 1];
  313.  
  314. public:
  315.     CStr32();
  316.     inline CStr32(unsigned char length)
  317.     {
  318.         fStr[0] = length;
  319.     }
  320.  
  321.  
  322.     CStr32(const CStr255& str);
  323.     CStr32(const CStr63& str);
  324.     CStr32(const CStr32& str);
  325.     CStr32(const CStr31& str);
  326.     CStr32(const unsigned char* str);
  327.     CStr32(const char* str);
  328.     CStr32(const long id);
  329.  
  330.  
  331.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  332.     
  333.     void Insert(const CString& str,
  334.                        short pos);
  335.     void Insert(const char* str,
  336.                        short pos);
  337.     CStr32 Copy(short pos, short length);
  338.  
  339.     // Concatenation operator
  340.     
  341.     CStr32& operator +=(const CString& str);
  342.     CStr32& operator +=(const char* str);
  343.     CStr32& operator +=(const char ch);
  344. };
  345.  
  346.  
  347. //----------------------------------------------------------------------------------------
  348. // CStr31:
  349. //----------------------------------------------------------------------------------------
  350.  
  351. struct CStr31 : CString
  352. {
  353.  
  354.     friend struct CStr255;
  355.     friend struct CStr63;
  356.     friend struct CStr32;
  357.  
  358. private:
  359.     unsigned char fData[kStr31Len - 1];
  360.  
  361. public:
  362.     CStr31();
  363.     inline CStr31(unsigned char length)
  364.     {
  365.         fStr[0] = length;
  366.     }
  367.  
  368.  
  369.     CStr31(const CStr255& str);
  370.     CStr31(const CStr63& str);
  371.     CStr31(const CStr32& str);
  372.     CStr31(const CStr31& str);
  373.     CStr31(const unsigned char* str);
  374.     CStr31(const char* str);
  375.     CStr31(const long id);
  376.  
  377.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  378.     
  379.     void Insert(const CString& str,
  380.                        short pos);
  381.     void Insert(const char* str,
  382.                        short pos);
  383.     CStr31 Copy(short pos, short length);
  384.  
  385.     // Concatenation operator
  386.     
  387.     CStr31& operator +=(const CString& str);
  388.     CStr31& operator +=(const char* str);
  389.     CStr31& operator +=(const char ch);
  390. };
  391.  
  392.  
  393. //----------------------------------------------------------------------------------------
  394. // CString inline function definitions
  395. //----------------------------------------------------------------------------------------
  396.  
  397. inline CString::operator unsigned char*()
  398. {
  399.     return (unsigned char *) this;
  400. }
  401.  
  402. inline CString::operator const unsigned char*() const
  403. {
  404.     return (const unsigned char *) this;
  405. }
  406.  
  407. inline void CString::Delete(short pos, short length)
  408. {
  409.     if ((pos > 0) && (length > 0) && (pos <= Length()))    // should also check that pos <= kMaxLength
  410.     {
  411.         if (pos + length > Length())
  412.             fStr[0] = pos - 1;
  413.         else
  414.         {
  415.             memcpy(&fStr[pos], &fStr[pos + length], Length() - (pos + length) + kLengthByte);
  416.             fStr[0] -= length;
  417.         }
  418.     }
  419. }
  420.  
  421.  
  422. //----------------------------------------------------------------------------------------
  423. // CStr255 inline function definitions
  424. //----------------------------------------------------------------------------------------
  425.  
  426. inline CStr255::CStr255()
  427. {
  428. }
  429.  
  430. inline CStr255::CStr255(const CStr255& str)
  431. {
  432.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  433. }
  434.  
  435. inline CStr255::CStr255(const CStr63& str)
  436. {
  437.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  438. }
  439.  
  440. inline CStr255::CStr255(const CStr32& str)
  441. {
  442.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  443. }
  444.  
  445. inline CStr255::CStr255(const CStr31& str)
  446. {
  447.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  448. }
  449.  
  450. inline CStr255::CStr255(const unsigned char* str)
  451. {
  452.     memcpy(fStr, str, kStr255Len + kLengthByte);
  453. }
  454.  
  455. inline CStr255& CStr255::operator = (const CStr255& str)
  456. {
  457.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  458.     
  459.     return *this;
  460. }
  461.  
  462. inline CStr255& CStr255::operator = (const CStr63& str)
  463. {
  464.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  465.     
  466.     return *this;
  467. }
  468.  
  469. inline CStr255& CStr255::operator = (const CStr32& str)
  470. {
  471.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  472.     
  473.     return *this;
  474. }
  475.  
  476. inline CStr255& CStr255::operator = (const CStr31& str)
  477. {
  478.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  479.     
  480.     return *this;
  481. }
  482.  
  483. inline CStr255& CStr255::operator = (const unsigned char* str)
  484. {
  485.     memcpy(fStr, str, kStr255Len + kLengthByte);
  486.     
  487.     return *this;
  488. }
  489.  
  490. inline CStr255& CStr255::operator = (const char aChar)
  491. {
  492.     if (aChar == '\0')                        // passing in an NULL char
  493.         Length() = 0;
  494.     else
  495.     {
  496.         Length() = 1;                        // CString gets length of 1
  497.         fStr[1] = aChar;                    // assign in the character
  498.     }
  499.     
  500.     return *this;
  501. }
  502.  
  503. inline void CStr255::Insert(const CString& str, short pos)
  504. {
  505.     InsertHelper(str, pos, kStr255Len);
  506. }
  507.  
  508. inline void CStr255::Insert(const char* str, short pos)
  509. {
  510.     InsertHelper(str, pos, kStr255Len);
  511. }
  512.  
  513.  
  514. //----------------------------------------------------------------------------------------
  515. // CStr63 inline function definitions
  516. //----------------------------------------------------------------------------------------
  517.  
  518. inline CStr63::CStr63()
  519. {
  520. }
  521.  
  522. inline CStr63::CStr63(const CStr255& str)
  523. {
  524.     // Truncate the CStr255 to 63 bytes if necessary.
  525.  
  526.     Length() = str.Length() > kStr63Len ? kStr63Len : str.Length();
  527.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  528. }
  529.  
  530. inline CStr63::CStr63(const CStr63& str)
  531. {
  532.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  533. }
  534.  
  535. inline CStr63::CStr63(const CStr32& str)
  536. {
  537.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  538. }
  539.  
  540. inline CStr63::CStr63(const CStr31& str)
  541. {
  542.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  543. }
  544.  
  545. inline CStr63::CStr63(const unsigned char* str)
  546. {
  547.     memcpy(fStr, str, kStr63Len + kLengthByte);
  548. }
  549.  
  550. inline void CStr63::Insert(const CString& str, short pos)
  551. {
  552.     InsertHelper(str, pos, kStr63Len);
  553. }
  554.  
  555. inline void CStr63::Insert(const char* str, short pos)
  556. {
  557.     InsertHelper(str, pos, kStr63Len);
  558. }
  559.  
  560.  
  561. //----------------------------------------------------------------------------------------
  562. // CStr32 inline function definitions
  563. //----------------------------------------------------------------------------------------
  564.  
  565. inline CStr32::CStr32()
  566. {
  567. }
  568.  
  569. inline CStr32::CStr32(const CStr255& str)
  570. {
  571.     // Truncate the CStr255 to 32 bytes if necessary.
  572.  
  573.     Length() = str.Length() > kStr32Len ? kStr32Len : str.Length();
  574.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  575. }
  576.  
  577. inline CStr32::CStr32(const CStr63& str)
  578. {
  579.     // Truncate the CStr63 to 32 bytes if necessary.
  580.  
  581.     Length() = str.Length() > kStr32Len ? kStr32Len : str.Length();
  582.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  583. }
  584.  
  585. inline CStr32::CStr32(const CStr32& str)
  586. {
  587.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  588. }
  589.  
  590. inline CStr32::CStr32(const CStr31& str)
  591. {
  592.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  593. }
  594.  
  595. inline CStr32::CStr32(const unsigned char* str)
  596. {
  597.     memcpy(fStr, str, kStr31Len + kLengthByte);
  598. }
  599.  
  600. inline void CStr32::Insert(const CString& str, short pos)
  601. {
  602.     InsertHelper(str, pos, kStr32Len);
  603. }
  604.  
  605. inline void CStr32::Insert(const char* str, short pos)
  606. {
  607.     InsertHelper(str, pos, kStr32Len);
  608. }
  609.  
  610.  
  611. //----------------------------------------------------------------------------------------
  612. // CStr31 inline function definitions
  613. //----------------------------------------------------------------------------------------
  614.  
  615. inline CStr31::CStr31()
  616. {
  617. }
  618.  
  619. inline CStr31::CStr31(const CStr255& str)
  620. {
  621.     // Truncate the CStr255 to 31 bytes if necessary.
  622.  
  623.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  624.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  625. }
  626.  
  627. inline CStr31::CStr31(const CStr63& str)
  628. {
  629.     // Truncate the CStr63 to 31 bytes if necessary.
  630.  
  631.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  632.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  633. }
  634.  
  635. inline CStr31::CStr31(const CStr32& str)
  636. {
  637.     // Truncate the CStr32 to 31 bytes if necessary.
  638.  
  639.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  640.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  641. }
  642.  
  643. inline CStr31::CStr31(const CStr31& str)
  644. {
  645.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  646. }
  647.  
  648. inline CStr31::CStr31(const unsigned char* str)
  649. {
  650.     memcpy(fStr, str, kStr31Len + kLengthByte);
  651. }
  652.  
  653. inline void CStr31::Insert(const CString& str, short pos)
  654. {
  655.     InsertHelper(str, pos, kStr31Len);
  656. }
  657.  
  658. inline void CStr31::Insert(const char* str, short pos)
  659. {
  660.     InsertHelper(str, pos, kStr31Len);
  661. }
  662.  
  663.  
  664. //----------------------------------------------------------------------------------------
  665. // Inline friend function definitions for relational string operators.
  666. //----------------------------------------------------------------------------------------
  667.  
  668. inline Boolean operator==(const CString& s1, const char* s2)
  669. {
  670.     return RelString(s1, CStr255(s2), false, true) == 0;
  671. }
  672.  
  673. inline Boolean operator==(const char* s1, const CString& s2)
  674. {
  675.     return RelString(CStr255(s1), s2, false, true) == 0;
  676. }
  677.  
  678. inline Boolean operator==(const CString& s1, const CString& s2)
  679. {
  680.     return RelString(s1, s2, false, true) == 0;
  681. }
  682.  
  683. inline Boolean operator!=(const CString& s1, const char* s2)
  684. {
  685.     return RelString(s1, CStr255(s2), false, true) != 0;
  686. }
  687.  
  688. inline Boolean operator!=(const char* s1, const CString& s2)
  689. {
  690.     return RelString(CStr255(s1), s2, false, true) != 0;
  691. }
  692.  
  693. inline Boolean operator!=(const CString& s1, const CString& s2)
  694. {
  695.     return RelString(s1, s2, false, true) != 0;
  696. }
  697.  
  698. inline Boolean operator>(const CString& s1, const char* s2)
  699. {
  700.     return RelString(s1, CStr255(s2), false, true) > 0;
  701. }
  702.  
  703. inline Boolean operator>(const char* s1, const CString& s2)
  704. {
  705.     return RelString(CStr255(s1), s2, false, true) > 0;
  706. }
  707.  
  708. inline Boolean operator>(const CString& s1, const CString& s2)
  709. {
  710.     return RelString(s1, s2, false, true) > 0;
  711. }
  712.  
  713. inline Boolean operator<(const CString& s1, const char* s2)
  714. {
  715.     return RelString(s1, CStr255(s2), false, true) < 0;
  716. }
  717.  
  718. inline Boolean operator<(const char* s1, const CString& s2)
  719. {
  720.     return RelString(CStr255(s1), s2, false, true) < 0;
  721. }
  722.  
  723. inline Boolean operator<(const CString& s1, const CString& s2)
  724. {
  725.     return RelString(s1, s2, false, true) < 0;
  726. }
  727.  
  728. inline Boolean operator>=(const CString& s1, const char* s2)
  729. {
  730.     return RelString(s1, CStr255(s2), false, true) >= 0;
  731. }
  732.  
  733. inline Boolean operator>=(const char* s1, const CString& s2)
  734. {
  735.     return RelString(CStr255(s1), s2, false, true) >= 0;
  736. }
  737.  
  738. inline Boolean operator>=(const CString& s1, const CString& s2)
  739. {
  740.     return RelString(s1, s2, false, true) >= 0;
  741. }
  742.  
  743. inline Boolean operator<=(const CString& s1, const char* s2)
  744. {
  745.     return RelString(s1, CStr255(s2), false, true) <= 0;
  746. }
  747.  
  748. inline Boolean operator<=(const char* s1, const CString& s2)
  749. {
  750.     return RelString(CStr255(s1), s2, false, true) <= 0;
  751. }
  752.  
  753. inline Boolean operator<=(const CString& s1, const CString& s2)
  754. {
  755.     return RelString(s1, s2, false, true) <= 0;
  756. }
  757.  
  758.  
  759. #endif
  760.  
  761.